﻿#region Using Statements
using DirectZZT.Shared.Gameplay;
using DirectZZT.Shared.Input;
using DirectZZT.Shared.Screens;
using Microsoft.Xna.Framework;
#endregion

namespace DirectZZT.Screens
{
    /// <summary>
    /// Provides the ingame menu screen.
    /// </summary>
    class IngameMenuScreen : ScreenBase
    {
        #region Fields

        private IInputManager _input;
        private IGameController _gameController;

        #endregion

        #region Methods

        /// <summary>
        /// Called on attach
        /// </summary>
        /// <param name="screenManager"></param>
        public override void OnAttach(IScreenManager screenManager)
        {
            base.OnAttach(screenManager);

            _input = this.ScreenManager.Game.Services.GetService(typeof(IInputManager)) as IInputManager;
            _gameController = this.ScreenManager.Game.Services.GetService(typeof(IGameController)) as IGameController;

            // pause game
            _gameController.PauseGame();
        }

        /// <summary>
        /// Updates the screen.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            if (_input.GetActionInvokedToggle("Menu.Back"))
            {
                // invoke ingame menu screen
                this.ScreenResult = Shared.Screens.ScreenResult.ExitScreen;

                // unpause game
                _gameController.ContinueGame();
            }
        }

        /// <summary>
        /// Draws the screen.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {

        }

        /// <summary>
        /// Disposes this screen.
        /// </summary>
        public override void Dispose()
        {
            base.Dispose();


        }

        #endregion

    }
}
